#ifndef __SPRITE_H__
#define __SPRITE_H__

#include <d3d9.h>
#include <d3dx9.h>

#include "Texture.h"

class Sprite
{
private:
	LPD3DXSPRITE spriteHandler;

	int time_animation;		//thoi gian chuyen 1 frame
	int time_local;			//tinh thoi gian de chuyen frame

	int index;				//chi so de tang frame
	int frame_begin;		//chi so frame bat dau
	int frame_end;			//chi so frame ket thuc

	Texture* p_texture;		//texture cua sprite

public:
	Sprite(LPD3DXSPRITE spriteHandler, Texture* p_texture, int time_animation, int index);
	~Sprite();

	Texture* getTexture() { return p_texture;}
	
	void update(int delta_time);
	void render(int X, int Y);
	void render(float X, float Y, int cameraX, int cameraY);
	void render(float X, float Y, float temp_x, float temp_y, int cameraX, int cameraY);

	void nextFrame();
	void resetFrame();
	void setFrame(int frame_begin, int frame_end);
	void setIndex(int index);
};
#endif